package lumis.portal.serialization.operation;

/**
 * Represents a config persistence operation
 *
 * @version $Revision: 4942 $ $Date: 2006-11-03 09:10:15 -0300 (Fri, 03 Nov 2006) $
 * @since 4.0.7
 */
public class ConfigPersistence extends ConfigOperation
{
	private final Object config;
	private final IConfigPersister configPersister;
	public ConfigPersistence(Object config, IConfigPersister configPersister)
	{
		super();
		this.config = config;
		this.configPersister = configPersister;
	}
	public Object getConfig()
	{
		return config;
	}
	public IConfigPersister getConfigPersister()
	{
		return configPersister;
	}
	@Override
	public int hashCode()
	{
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((config == null) ? 0 : config.hashCode());
		result = PRIME * result + ((configPersister == null) ? 0 : configPersister.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final ConfigPersistence other = (ConfigPersistence) obj;
		if (config == null)
		{
			if (other.config != null)
				return false;
		}
		else if (!config.equals(other.config))
			return false;
		if (configPersister == null)
		{
			if (other.configPersister != null)
				return false;
		}
		else if (!configPersister.equals(other.configPersister))
			return false;
		return true;
	}
}
